<?php 
	$this->headTitle ( 'Running Elections' );
?>
<style type="text/css">

	#view-table
	{
		font-family:Verdana, Arial, Helvetica, sans-serif;
		font-size: 11px;
		color: #000;
		background: #fff;
		border-collapse: collapse;
		text-align: left;
	}

	#view-table tr
	{
		font-size: 16px;
		font-weight: bold;
		color: #000;
		padding: 10px 2px 5px 2px;
		border-bottom: 1px solid #373737;
	}

	#view-table td
	{
		color: #4e4e4e;
		padding: 5px 2px 5px 0px;
	}

	#view-table tbody tr:hover td
	{
		font-size: 14px;
		font-weight: bold;
		color: #000;
		background: #efefef; 
	}

	#view-table .odd
	{
		background: #f8f8f8; 
	}
	
</style>
<div id="form-container">
<h1>Running Elections</h1>
<br />
<?php if (!$this->last_winner): ?>
	<h2>No elections held</h2>
<?php elseif ($this->last_winner == 0): ?>
	<h2>The last election was voided</h2>
<?php elseif ($this->last_winner != 0): ?>
	<h2>Winner of the previous week</h2>
	<br />
	<table id="view-table" cellspacing="0" align="center"  width="100%" summary="View Hotel">
		<tr>
			<th width="200px">Date of Election</th>		
			<th width="200px"><?php echo $this->escape($this->last_winner->date) ?></th>		
		</tr>
		<tr>
			<th width="200px">Number of Votes</th>		
			<th width="200px"><?php echo $this->escape($this->last_winner->votes) ?></th>		
		</tr>
		<tr>
			<th width="200px">Image</th>		
			<th width="200px"><img src="<?php echo $this->escape($this->baseUrl().'/images/'.$this->last_winner->picture) ?>" width=379 height=170 "></th>		
		</tr>
		<tr>
			<th width="200px">Title</th>		
			<th width="200px"><?php echo $this->escape($this->last_winner->title) ?></th>		
		</tr>
		<tr>
			<th width="200px">Money Amount requested</th>		
			<th width="200px"><?php echo $this->escape($this->last_winner->funds) ?></th>		
		</tr>
		<tr>
			<th width="200px">Description</th>		
			<th width="200px"><?php echo $this->escape($this->getWords($this->last_winner->description, 20)) ?></th>		
		</tr>
		<tr>
			<th width="200px">User</th>		
			<th width="200px"><?php echo $this->escape($this->last_winner->user) ?></th>		
		</tr>
		<tr>
			<th width="200px"></th>		
			<th width="200px"><a href="<?php echo $this->escape($this->linkTo('view','project',null, array('id' => $this->last_winner->id_project))) ?>">Full Info</a></th>		
		</tr>
	</table>
<?php endif; ?>
<h2>Top 10 Contesters</h2>
<br />
<?php $projectList = $this->action('list', 'project', null, array('top' => 10)); ?>
<?php if (strpos($projectList, 'table')): ?>
	<?php echo $projectList; ?> 
<?php else: ?>
	<h3>Sorry No Contesters</h3>
<?php endif; ?>
</div>